﻿namespace CodePen.Server.Models;

/// <summary>
/// 分类
/// </summary>
[SugarTable(nameof(PickCategory), "分类")]
[SugarIndex("idx_pickcategory_code", nameof(Code), OrderByType.Asc)] // 代码索引
[SugarIndex("idx_pickcategory_status", nameof(IsDisable), OrderByType.Asc)] // 状态索引
public class PickCategory : EntityBase
{ 
    /// <summary>
     /// 代码
     /// </summary>
    [SugarColumn(ColumnDescription = "代码", IsNullable = false)]
    public string Code { get; set; }
    /// <summary>
    /// 名称
    /// </summary>
    [SugarColumn(ColumnDescription = "名称", IsNullable = false)]
    public string Name { get; set; }
    /// <summary>
    /// 状态-正常_0、停用_1 
    /// </summary>
    [SugarColumn(ColumnDescription = "是否禁用", IsNullable = true)]
    public YesOrNot? IsDisable { get; set; }

    /// <summary>
    /// 导航属性-一对多
    /// </summary>
    [Navigate(NavigateType.OneToMany, nameof(PickContent.CategoryId))]
    public List<PickContent> Contents { get; set; } = new List<PickContent>();
}